package view;

import java.awt.Graphics;
import javax.swing.*;
import model.AbstractBullet;
import model.Player;
import model.World;

public class MovingView extends JPanel{
	
	public MovingView(){}
	
	public void drawSmurfs(Graphics g){
		for(Player player : World.getInstance().getPlayers()){
			if(player != null){
				player.getSmurf().draw(g);
			}			
		}
	}
	
	public void drawBullets(Graphics g){
		for(Player player : World.getInstance().getPlayers()){
			if(player != null){
				for(AbstractBullet bullet : player.getSmurf().getBullets()){
					bullet.draw(g);
				}
			}
		}
	}
	
	@Override
	protected void paintComponent(Graphics g){
		super.paintComponent(g);
		drawSmurfs(g);
		drawBullets(g);
	}
}
